home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / LANG / C / LIB / UNIXLIB37B / !UnixLib37 / src / stdio / c / putw < prev    next >
Text File  |  1996-11-09  |  903b  |  40 lines

  1. /****************************************************************************
  2.  *
  3.  * $Source: /unixb/home/unixlib/source/unixlib37/src/stdio/c/RCS/putw,v $
  4.  * $Date: 1996/04/19 21:32:42 $
  5.  * $Revision: 1.1 $
  6.  * $State: Rel $
  7.  * $Author: simon $
  8.  *
  9.  * $Log: putw,v $
  10.  * Revision 1.1  1996/04/19 21:32:42  simon
  11.  * Initial revision
  12.  *
  13.  ***************************************************************************/
  14.  
  15. static const char rcs_id[] = "$Id: putw,v 1.1 1996/04/19 21:32:42 simon Rel $";
  16.  
  17. #include <stdio.h>
  18.  
  19. #define INTSIZE 4
  20.  
  21. __STDIOLIB__
  22.  
  23. int
  24. putw (register int i, register FILE * f)
  25. {
  26.   putc (i & 0xff, f);
  27.   putc ((i >> 8) & 0xff, f);
  28. #if INTSIZE > 2
  29.   putc ((i >> 16) & 0xff, f);
  30.   putc ((i >> 24) & 0xff, f);
  31. #if INTSIZE > 4
  32.   putc ((i >> 32) & 0xff, f);
  33.   putc ((i >> 40) & 0xff, f);
  34.   putc ((i >> 48) & 0xff, f);
  35.   putc ((i >> 56) & 0xff, f);
  36. #endif
  37. #endif
  38.   return (ferror (f) ? -1 : i);
  39. }
  40.